/**
 * 给定数组，回答询问：[s, e]之间找出一对不一样的数
 * 直接找最大最小值即可
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using value_t = int;

void sparseTable(value_t const a[],int n,int mmin[][20],int mmax[][20]){
    for(int i=0;i<n;++i) mmin[i][0] = mmax[i][0] = i;

    for(int j=1,tmp;(tmp=(1<<j))<=n;++j){
        for(int i=0;i+tmp<=n;++i){
            mmin[i][j] = a[mmin[i][j-1]] < a[mmin[i+(tmp>>1)][j-1]] ? mmin[i][j-1] : mmin[i+(tmp>>1)][j-1];
            mmax[i][j] = a[mmax[i][j-1]] < a[mmax[i+(tmp>>1)][j-1]] ? mmax[i+(tmp>>1)][j-1] : mmax[i][j-1];
        }
    }
}

pair<int, int> query(value_t const a[],int const mmin[][20],int const mmax[][20],int s,int e){
    int k = (int)(log(double(e-s+1))/log(2.0));
    int fi = mmin[s][k];
    if(a[mmin[e-(1<<k)+1][k]] < a[fi]) fi = mmin[e-(1<<k)+1][k];
    int se = mmax[s][k];
    if(a[mmax[e-(1<<k)+1][k]] > a[se]) se = mmax[e-(1<<k)+1][k];
    return {fi, se};
}

int const SZ = 2e5+10;

int Q;
int N;
vi A;
int Dmin[SZ][20], Dmax[SZ][20];

void proc(){
    sparseTable(A.data(), N, Dmin, Dmax);
    cin >> Q;
    for(int a,b,q=1;q<=Q;++q){
        cin >> a >> b;
        auto ans = query(A.data(), Dmin, Dmax, a - 1, b - 1);
        if(A[ans.first] != A[ans.second]){
            cout << ans.first + 1 << " " << ans.second + 1 << "\n";
        }else{
            cout << "-1 -1\n";
        }
    }
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1; 
    cin >> nofkase;
    while(nofkase--){
        cin >> N;
        A.assign(N, {});
        // B.assign(M, {});
        for(auto & i : A) cin >> i;
        // for(auto & i : B) cin >> i;
        proc();  
    }
    return 0;
}